package user_db

import (
	database "hft/Database"
	"time"
)

type Clue struct {
	ID           uint        `json:"id" gorm:"primaryKey;autoIncrement"`
	CreateTime   time.Time   `json:"create_time" gorm:"autoCreateTime"`
	UserID       uint        `json:"user_id" gorm:"comment:用户id"`       //客户ID
	ActivityName string      `json:"activity_name" gorm:"comment:活动名称"` //活动名称
	ActivityCode int         `json:"activity_code"`                     //活动Code
	LouPanID     int         `json:"lou_pan_id" gorm:"comment:楼盘id;default:0"`
	LouName      string      `json:"lou_name"`
	Port         int         `json:"port" gorm:"comment:端口：小程序，H5端之类的;default:1"`
	RegionName   string      `json:"region_name"`
	OriginType   int         `json:"origin_type" gorm:"comment:端口类型 1:线索留资 2:IM消息 3:400来电 4:手动录入"` //端口类型 1:线索留资 2:IM消息 3:400来电 4:手动录入
	IP           string      `json:"ip"`
	PhoneRecord  PhoneRecord `json:"phone_record,omitempty" gorm:"foreignKey:ClueID;references:ID;constraint:OnDelete:CASCADE"`
	HelpSelect   HelpSelect  `json:"help_select" gorm:"foreignKey:ClueID;references:ID;constraint:OnDelete:CASCADE"`
	Reservation  Reservation `json:"reservation" gorm:"foreignKey:ClueID;references:ID;constraint:OnDelete:CASCADE"`
}

func (Clue) TableName() string {
	return database.TableNameFormat("front_clue")
}
